package com.jin.concurrent.example.atomic;

import com.jin.concurrent.annoations.ThreadSafe;
import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Semaphore;
import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.atomic.LongAdder;

/**
 * @author JinLiu
 */
@Slf4j
@ThreadSafe
public class AtomicExample4 {

    private static AtomicReference count =  new AtomicReference<>(0);

    public static void main(String[] args) {
        count.compareAndSet(0, 2);
        count.compareAndSet(0, 1);
        count.compareAndSet(1, 4);
        count.compareAndSet(2, 6);

        log.info("count: {}", count.get());
    }

}
